<%@ taglib uri="/tags/struts-bean" prefix="bean"%>
<%@ taglib uri="/tags/struts-html" prefix="html"%>
<%@ taglib uri="/tags/struts-logic" prefix="logic"%>
<%@ taglib uri="/tags/core" prefix="c"%>
<%@ taglib uri="/tags/fmt" prefix="fmt"%>
<%@ taglib uri="/WEB-INF/tld/security.tld" prefix="s" %>

<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript">
function submitVersionQuery(form, orderField, orderType){
		form.orderField.value = orderField;
		form.orderType.value = orderType;
		if (validSubmit){
			form.submit();
		} else {
			alert('<fmt:message key="warning.message.common.processing"/>');
		}
	}
</script>
<html:form action="/versionList" method="POST">
	<html:hidden property="orderField"/>
	<html:hidden property="orderType"/>
</html:form>
<!--<html:form action="/filterSearchVersion" method="POST">
<table align="center" width="45%" cellpadding="2" cellspacing="1" border="0" bgcolor="#CCCCC0">
		<tr>
			<th colspan="4" align="center" class="titulocolumna"> <bean:message key="label.breadcrum.version.list"/> </th>			 
		</tr>		
		<tr>
			<td class="etiqueta">
				<bean:message key="label.creditline.balance.initialperiod"/>
			</td>
 			<td class="columnadatoPar" align="center">
				<select id="initPeriod" class="campo_texto" name="initPeriod">
					<c:forEach items="${monthPeriods}" var="monthPeriod" varStatus="status">
						<c:choose>
							<c:when test="${monthPeriod.monthPeriodId == actualMonth}">
								<option value="<c:out value="${monthPeriod.month}"/>|<c:out value="${monthPeriod.year}"/>|<c:out value="${monthPeriod.listDescription}"/>" selected="selected"><c:out value="${monthPeriod.listDescription}"/></option>
							</c:when>
							<c:otherwise>
								<option value="<c:out value="${monthPeriod.month}"/>|<c:out value="${monthPeriod.year}"/>|<c:out value="${monthPeriod.listDescription}"/>"><c:out value="${monthPeriod.listDescription}"/></option>
							</c:otherwise>
						</c:choose>
					</c:forEach>
				</select>
			</td>
			<td class="etiqueta">
				<bean:message key="label.creditline.balance.finalperiod"/>
			</td>
			<td class="columnadatoPar" align="center">
				<select id="endPeriod" class="campo_texto" name="endPeriod">					
					<c:forEach items="${monthPeriods}" var="monthPeriod" varStatus="status">
						<option value="<c:out value="${monthPeriod.month}"/>|<c:out value="${monthPeriod.year}"/>|<c:out value="${monthPeriod.listDescription}"/>"><c:out value="${monthPeriod.listDescription}"/></option>
					</c:forEach>
				</select>
			</td>
		</tr>	
		<tr>
			<td class="etiqueta">
				<bean:message key="label.common.short.description"/>
			</td>
			<td class="columnadatoPar" align="center" colspan="3">
			    <html:text styleClass="campo_texto" property="shortDescription" onfocus="this.select();" style="width:240px" />&nbsp;&nbsp; 
				<input type="submit" value="<bean:message key="label.common.query"/>" class="boton"> 
			</td>		
		</tr>			
</table>	
</html:form>  -->
<br />
<table align="center" width="660" cellpadding="2" cellspacing="1" border="0" bgcolor="#CCCCC0">
	<tr>
		<td class="titulocolumna" align="center" width="20">
			<s:entidad nombreCortoMod="PROC" nombreCortoSub="VERSION" nombreCortoEnt="NEW" permiso="ADMINISTRACION">
				<html:link action="/showAddVersion.do"><img alt="<bean:message key="label.common.add"/> <bean:message key="label.versions.name"/>" src="images/nuevo.gif" border="0"></html:link>
			</s:entidad>
		</td>
		<td class="titulocolumna" align="center" width="120">
			<a href="#>" onclick="return submitVersionQuery(document.VersionForm, 0,'<c:choose><c:when test="${previousOrderField == 0 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="label.versions.startDate"/>
				<c:choose>
					<c:when test="${previousOrderField == 0 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 0 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>		
		</td>
		<td class="titulocolumna" align="center" width="120">
			<a href="#>" onclick="return submitVersionQuery(document.VersionForm, 1, '<c:choose><c:when test="${previousOrderField == 1 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="label.versions.endDate"/>
				<c:choose>
					<c:when test="${previousOrderField == 1 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 1 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>	
		</td>
		<td class="titulocolumna" align="center" width="80">
			<a href="#>" onclick="return submitVersionQuery(document.VersionForm, 2, '<c:choose><c:when test="${previousOrderField == 2 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="label.versions.shortName"/>
				<c:choose>
					<c:when test="${previousOrderField == 2 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 2 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>
		</td>
		<td class="titulocolumna" align="center" width="200">
			<a href="#>" onclick="return submitVersionQuery(document.VersionForm, 3, '<c:choose><c:when test="${previousOrderField == 3 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="label.versions.description"/>
				<c:choose>
					<c:when test="${previousOrderField == 3 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 3 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>	
		</td>
		<td class="titulocolumna" align="center" width="100">
			<a href="#>" onclick="return submitVersionQuery(document.VersionForm, 4, '<c:choose><c:when test="${previousOrderField == 4 && previousOrderType == 0}">1</c:when><c:otherwise>0</c:otherwise></c:choose>');" class="ligas">
				<bean:message key="label.versions.imported"/>
				<c:choose>
					<c:when test="${previousOrderField == 4 && previousOrderType == 1}">
						<img alt="<bean:message key="label.common.order.ascending"/>" src="images/arrow_up.gif" border="0"/>
					</c:when>
					<c:when test="${previousOrderField == 4 && previousOrderType == 0}">
						<img alt="<bean:message key="label.common.order.descending"/>" src="images/arrow_down.gif" border="0"/>
					</c:when>
				</c:choose>
			</a>	
		</td>
		<td width="20" class="titulocolumna" align="center">&nbsp;</td>
		<td width="20" class="titulocolumna" align="center">&nbsp;</td>
	</tr>
	<logic:notEmpty name="listVersionViews">
		<logic:iterate id="row" name="listVersionViews" indexId="int_i">
			<tr class="<%=((int_i.intValue()%2)==0?"columnadatoPar":"columnadatoNon")%>">							
				<td align="center">
					<s:entidad nombreCortoMod="PROC" nombreCortoSub="VERSION" nombreCortoEnt="EDIT" permiso="ADMINISTRACION">
						<html:link action="/showEditVersion.do" paramId="versionView.versionId" paramName="row" paramProperty="versionId"> <img alt="<bean:message key="common.edit"/> <bean:write name="row" property="shortName"/>" src="images/modificar.gif" border="0"> </html:link>
					</s:entidad>
				</td>							
				<td align="center"><bean:write name="row" property="startDate"/></td>
				<td align="center"><bean:write name="row" property="endDate"/></td>
				<td align="left"><bean:write name="row" property="shortName"/></td>
				<td align="left"><bean:write name="row" property="description"/></td>
				<td align="left" onmouseover="showtip(this,event,'<bean:write name="row" property="parentDescription"/>');" onmouseout="hidetip();"><bean:write name="row" property="parentShortName"/></td>
				<td align="center">
					<s:entidad nombreCortoMod="PROC" nombreCortoSub="VERSION" nombreCortoEnt="VERDET" permiso="ADMINISTRACION">
						<html:link action="/showVersionDetail.do" paramId="versionView.versionId" paramName="row" paramProperty="versionId"><img alt="<bean:message key="label.versions.versionDetail"/> <bean:write name="row" property="shortName"/>" src="images/clipboard_paste_image.png" border="0"></html:link>
					</s:entidad>
				</td>
				<td align="center">
					<s:entidad nombreCortoMod="PROC" nombreCortoSub="VERSION" nombreCortoEnt="DELETE" permiso="ADMINISTRACION">
						<a href="#>" onclick="if( confirmDelete('<bean:write name="row" property="shortName"/>') )location.href='versionDelete.do?versionId=<bean:write name="row" property="versionId"/>';"><img alt="<bean:message key="common.delete"/>  <bean:write name="row" property="shortName"/>" src="images/eliminar.jpg" border="0"></a>
					</s:entidad>
				</td>
			</tr>
		</logic:iterate>
	</logic:notEmpty>
</table>
<br />
<br />